$(function() {
	loadBdms();
})
function loadBdms() {
	$.ajax({
		url : '/bdm',
		method : 'get',
		data : {
			time : new Date(),
			limit : 10,
			offset : 0
		},
		dataType : 'json',
		success : function(result) {
			if("SUCCESS" == result.result) {
				var html = "<tr>";
				var obj = result.object;
				var data = obj.data;
				var total = obj.total;
				for(var i=0;i<data.length;i++) {
					var bdm = data[i];
					html = html + "<tr id='"+bdm.id+"'>";
					html = html + "<td>"+bdm.title+"</td>";
					html = html + "<td>"+bdm.year+"</td>";
					html = html + "<td>"+bdm.dept+"</td>";
					html = html + "<td>"+bdm.budgetAll+"</td>";
					html = html + "<td>"+bdm.budgetCan+"</td>";
					html = html + "<td>"+bdm.budgetLock+"</td>";
					html = html + "<td>"+bdm.budgetHave+"</td>";
					html = html + "<td>"+bdm.signCode+"</td>";
					html = html + "<td>"+bdm.signTime+"</td>";
					html = html + "</tr>";
				}
				$("#bdms-content").html(html);
				initEvent();
			}
		}
	});
}


function initEvent() {
    $('#bdms-content tr').click(function() {
        var id = $(this).attr("id");
        window.open('/statistics/bdm/' + id);
    });
}